package com.disruptor.controller;

import com.disruptor.akka.Akka;
import com.disruptor.akka.MyWork;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by mengdexuan on 2017/9/20 17:46.
 */
@Controller
@RequestMapping("/akka")
public class AkkaController {

	private Logger log = LoggerFactory.getLogger(getClass());

	@RequestMapping("/send")
	public String send(Integer flag){

		if (flag==1){
			for (int i=0;i<10;i++){
				Akka.send(MyWork.Msg.WORKING);
			}
		}else if (flag==2){
			Akka.send(MyWork.Msg.DONE);
		}else {
			Akka.send(MyWork.Msg.CLOSE);
		}

		return "redirect:/";
	}


}
